package com.jameskarl.amap.map

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import io.flutter.plugin.common.PluginRegistry

fun PluginRegistry.Registrar.loadFlutterImage(flutterImageName: String?): Bitmap? {
    val assetName = flutterImageName ?: return null
    val hostActivity = activity() ?: return null
    val name = lookupKeyForAsset(assetName) ?: return null
    hostActivity.assets.open(name).use {
        return BitmapFactory.decodeStream(it)
    }
}